import request from '@/utils/request'
// 获取角色列表
export const reqGetRoleList = (page, pagesize) => request({
  method: 'get',
  url: '/sys/role',
  params: {
    page, // 页码
    pagesize // 每页条数
  }
})

// 删除角色
export const reqDeleteRole = id => request({
  method: 'delete',
  url: '/sys/role/' + id
})

// 新增角色
export const reqAddRole = data => request({
  method: 'post',
  url: 'sys/role',
  data
})
/**
 * 根据 id 获取角色详情, 用于回显
 * **/
export const reqGetRoleDetail = (id) =>
  request({
    method: 'get',
    url: `/sys/role/${id}`
  })

/** *
 * 修改角色
 * **/
export const reqUpdateRole = (data) =>
  request({
    method: 'put',
    url: `/sys/role/${data.id}`,
    data
  })

export function reqAssignPerm(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
